#include<YLFW/Shader.h>
#include<YLFW/VertexObject.h>
#include<YLFW/YLFWTexture.h>
#include<YLFW/YLFWWindow.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
static int TestMain() {
	YLFWWindow* window = YLFWWindow::CreateWindow(800, 600, "Transformations");
	Shader shader("Assets/Shaders/coordinate_systems.vs", "Assets/Shaders/coordinate_system.fs");
	YLFWTexture texture("Assets/Images/wall.jpg");
	float vertices[] = {
		0.5f,0.5f,0.0f,1.0f,1.0f,
		0.5f,-0.5f,0.0f,1.0f,0.0f,
		-0.5f,-0.5f,0.0f,0.0f,0.0f,
		-0.5f,0.5f,0.0f,0.0f,1.0f,
	};
	unsigned int indices[] = {
		0,1,3,
		1,2,3
	};
	VertexObject vertexObject(vertices, sizeof(vertices), indices, sizeof(indices));

	float currentTime = (float)glfwGetTime();
	while (!window->IsClose()) {
		if (window->GetKey(GLFW_KEY_ESCAPE)) {
			window->Close();
		}
		window->Clear();

		glm::mat4 model = glm::mat4(1.0f);
		glm::mat4 view = glm::mat4(1.0f);
		glm::mat4 projection = glm::mat4(1.0f);
		model = glm::rotate(model,glm::radians(-55.0f),glm::vec3(1.0f,0.0f,0.0f));
		view = glm::translate(view, glm::vec3(0.0f, 0.0f, -2.0f));
		projection = glm::perspective(glm::radians(45.0f), (float)800/600, 0.1f, 100.0f);


		shader.setMatrix4fv("model",model);
		shader.setMatrix4fv("view",view);
		shader.setMatrix4fv("projection",projection);
		window->DrawTriangles(shader, vertexObject, texture);

		window->SwapBuffers();
		window->PullEvent();
	}
	delete window;
	YLFWWindow::Terminate();
	return 0;
}